<!DOCTYPE html>
<html>
<head>
<title>SMART - Dashboard</title>
<jsp:include page="../include/head.jsp" />
</head>
<body>
   <div class="wrapper">
      <!-- 导航区 -->
      <jsp:include page="../include/topnav.jsp" />
      <!-- 左侧菜单区 -->
      <jsp:include page="../include/menu.jsp" />
      <!-- 右侧边栏 -->
      <jsp:include page="../include/right.jsp" />
      <!-- Main section-->
      <section>
         <!-- Page content-->
         <div class="content-wrapper">
            <div class="content-heading">编辑公告</div>
            <div class="panel panel-default">
            	<div class="panel-body">
            		<jsp:include page="../include/info.jsp" />
					<form role="form" action="admin/notice/edit" method="post" class="form-horizontal">
						<c:if test="${obj!=null}">
							<input type="hidden" name="id" value="${obj.id}" />
						</c:if>
						<div class="form-group">
							<label for="title" class="col-sm-2 control-label">标题</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="title" name="title" value="${obj.title}" />
							</div>
						</div>
						<div class="form-group">
							<label for="hot" class="col-sm-2 control-label">分类</label>
							<div class="col-sm-10">
								<label class="radio-inline"> 
									<input type="radio" name="type" id="type1" value="1" <c:if test="${obj.type eq '1'}">checked</c:if>> 新闻
								</label> 
								<label class="radio-inline"> 
									<input type="radio" name="type" id="type2" value="2" <c:if test="${obj.type eq '2'}">checked</c:if>> 问答
								</label>
								<label class="radio-inline"> 
									<input type="radio" name="type" id="type3" value="3" <c:if test="${obj.type eq '3'}">checked</c:if>> 贷款技巧
								</label>
								<label class="radio-inline"> 
									<input type="radio" name="type" id="type4" value="4" <c:if test="${obj.type eq '4'}">checked</c:if>> 帮助文档
								</label>
							</div>
						</div>
						<div class="form-group">
							<label for="content" class="col-sm-2 control-label">封面图</label>
							<div class="col-sm-10">
								<div class="input-group">
									<input type="text" class="form-control" id="coverImg" name="coverImg" value="${obj.coverImg}" />
									<span class="input-group-btn">
										<button class="btn btn-default" id="btnCoverImg" type="button">浏览</button>
									</span>
								</div>
							</div>
						</div>
						<div class="form-group">
							<label for="content" class="col-sm-2 control-label">内容</label>
							<div class="col-sm-10">
								<textarea rows="10" cols="100" name="content" id="content">${obj.content}</textarea>
							</div>
						</div>
						<div class="form-group">
							<label for="hot" class="col-sm-2 control-label">是否置顶</label>
							<div class="col-sm-10">
								<label class="radio-inline"> 
									<input type="radio" name="isTop" id="isTopTrue" value="true" <c:if test="${obj.isTop}">checked</c:if>> 是
								</label> 
								<label class="radio-inline"> 
									<input type="radio" name="isTop" id="isTopfalse" value="false" <c:if test="${!obj.isTop}">checked</c:if>> 否
								</label>
							</div>
						</div>

						<div class="form-group" >
							<div class="col-sm-2"></div>
							<div class="col-sm-10">
								<button type="submit" class="btn btn-primary">提交</button>
								<a href="admin/notice/list" class="btn btn-primary">返回</a>	
							</div>
						</div>
					</form>
			 	</div>
			</div>
         </div>
      </section>
      <jsp:include page="../include/footer.jsp" />
   </div>
   <jsp:include page="../include/script.jsp" />
   <script src="ckfinder/ckfinder.js"></script>
   <script src="ckeditor/ckeditor.js"></script>
</body>
</html>
<script>
$('#mainMenu li').removeClass('active');
$('#menuXXX').addClass('active');

$('#image').focus(function(){
	var that = $(this);
	var finder = new CKFinder();
	finder.selectActionFunction = function(path){
		$(that).val(path);
		$('#imagePreview').attr('src', path).css('width', '100%').css('height', 'auto').show();
	};

	finder.popup();
})
$('#btnCoverImg').click(function(){
	var finder = new CKFinder();
	finder.selectActionFunction = function(path){
		$('#coverImg').val(path);
	};
	finder.popup();
})
CKEDITOR.replace('content', {
	height: 500
});
</script>